module core_control(original_clk,rstn,led_sel,led_drv,key1,key2,key3);
/*
用于连接各个模块,控制输入输出, 显示
*/
input original_clk,rstn;
output [7:0] led_drv;
output [5:0] led_sel;
input key1,key2,key3;
//指定 端口的类型
wire original_clk,rstn;
wire [7:0] led_drv;
wire [5:0] led_sel;
wire key1,key2,key3;
wire [8:0]  original_in;
wire [9:0]  out;
wire [9:0]  out_standard;
wire [43:0] data;
wire rd;
wire correct;
wire check;
wire decode_in;
wire [7:0] decode_out;
assign check = (out_standard==out) ? 1 : 0 ;
//空的 内容  因为起始的第一个4bit 灯的不能用的(灭了)作为游动 标志
assign data[43:40] = {4'b0};
//将输入内容送显示模块
assign data[39:28] = {3'b0,original_in};
// 将输出结果送显示模块
assign data[27:16] = {2'h0,out};
//将rd送显示模块
assign data[15:12] = {3'b000,rd};
//将检查标志位送显示模块
assign data[11:8] = {3'b000,correct};
//将解码的结果送显示模块
assign data[7:0] = {decode_out};



//标准真值表校验
//original_in,out_standard,rd_standard,key1,rstn
// encode_standard biaozhun(
	// .original_in(original_in),
	// .out_standard(out_standard),
	// .rd(rd),
	// .key1(key1),
	// .rstn(rstn)
	// );




//编码主模块例化
encode8b10b1 en8to10(
	.original_in(original_in),
	.original_clk(original_clk),
	.rstn(rstn),
	.key1(key1),
	.rd(rd),
	.out(out)
	);


//解码计算模块例化
decode_calculation de10to8(
.decode_in(out),
.decode_out(decode_out),
.correct(correct)
);

//显示模块	
display2 segxianshi(
	.original_clk(original_clk),
	.led_sel(led_sel),
	.led_drv(led_drv),
	.rstn(rstn),
	.data(data)
	);

//输入模块
encode_input_generate shuru(
	.original_clk(original_clk),
	.key1(key1),
	.key2(key2),
	.key3(key3),
	.original_in(original_in),
	.rstn(rstn)
	);

	
	
endmodule